﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;

using System.Text;
using OgilvyOne.Ext.Weibo.Common;
using OgilvyOne.Ext.Weibo.Configuration;
using OgilvyOne.Ext.Weibo.Lib;

using ECCIT;
using ECCIT.Data;
using OgilvyOne.Model;
using OgilvyOne.BLL;
using OgilvyOne.Ext.Weibo.Model;
using System.Collections.ObjectModel;

using System.Configuration;
using System.Data;
using System.Collections;
using OglivyOne.Ext.Log;
using Environment_v2 = OgilvyOne.Ext.Weibo.Configuration.Environment;

using Microblog_v2 = OgilvyOne.Ext.Weibo.Lib.Microblog;
using UserInfo_v2 = OgilvyOne.Ext.Weibo.Model.UserInfo;
using Users_v2 = OgilvyOne.Ext.Weibo.Model.Users;
using MicroblogException_v2 = OgilvyOne.Ext.Weibo.Common.MicroblogException;
using Source_v2 = OgilvyOne.Ext.Weibo.Model.Source;
using System.Xml.Serialization;

public partial class GetMessage : System.Web.UI.Page
{
    StringBuilder sb = new StringBuilder();
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //Weiboinfo wb1 = new Weiboinfo();
            //OAuthAccessToken Otoken = new OAuthAccessToken();
            //Otoken.Token = "2.00FTmXrCUIiAiD3041789e7dqvzWbB";
            //wb1.WeiboToken = Otoken;
            //wb1.WeiboUID = "2623462611";
            //Session["weibo"] = wb1;
            //Session["guid"] = "380a0ca1-bfab-4418-8c9d-d4943f8fca86";

            //Statuses template = new Statuses();
            //template = Microblog.GetMentions(wb1.WeiboToken, null, null, 1, 200); //@我的

            var begindatetime = DateTime.Now;

            string guid = Request.QueryString["guid"];
            if (Session["weibo"] != null) //获取登录用户的微博数据
            {
                //OgilvyOne.BLL.DataCache.RemoveCache(Session["guid"].ToString()); //清楚缓存
                object ojb = OgilvyOne.BLL.DataCache.GetCache(Session["guid"].ToString());
                if (ojb == null)
                {
                    //if(string.IsNullOrEmpty(guid)
                    //{
                    Response.ContentType = "text/xml";
                    Response.ContentEncoding = Encoding.UTF8;
                    sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
                    sb.AppendLine(@"<root>");
                    Weiboinfo wb = new Weiboinfo();
                    wb = (Session["weibo"] as Weiboinfo);
                    GetUserInfo(wb.WeiboToken, wb.WeiboUID);        //获取用户信息
                    GetMyFansFromSina(wb, true);                          //获取粉丝
                    GetGeo(wb);                                     //获取用户发布的地理信息微博
                    GetImg(wb);                                     //获取个人图片微博数据
                    GetComment(wb);                                   //获取个人获得的评论
                    GetMyFansFromSina(wb, false);                         //获取关系紧密的好友
                    sb.AppendLine(@"</root>");
                    //Session["xml"] = sb;                          //将xml保存到库中

                    OgilvyOne.BLL.DataCache.SetCache(Session["guid"].ToString(), sb);

                    WriteLog("用户ID:"+wb.WeiboUID+"页面加载花费时间：" + (DateTime.Now - begindatetime).TotalMilliseconds.ToString() + "毫秒");

                    // SaveXml(sb, Session["guid"].ToString());
                    // }
                    //else
                    //{//用户分享时 将xml保存到数据库
                    //    sb = new StringBuilder(GetXml(guid));
                    //}
                }
                else
                {
                    Response.Write(ojb.ToString());
                }
            }
            else
            {
                Response.ContentType = "text/xml";
                Response.ContentEncoding = Encoding.UTF8;
                sb.AppendLine(@"<?xml version='1.0' encoding='utf-8' ?>");
                sb.AppendLine(@"<root>");
                sb.AppendLine(string.Format("<result>{0}</result>", "0"));
                sb.AppendLine(@"</root>");
            }
            if (Session["weibo"] == null&&!string.IsNullOrEmpty(guid))   //回放
            {
                var result = new StringBuilder(GetXml(guid));
                if (result.Length > 0)
                {
                    sb = result;
                }
                else //处理重数据库查询没有结果的情况 李学明 2012-5-28
                {
                    Response.ContentType = "text/xml";
                    Response.ContentEncoding = Encoding.UTF8;
                    sb.AppendLine(@"<?xml version='1.0' encoding='utf-8' ?>");
                    sb.AppendLine(@"<root>");
                    sb.AppendLine(@"<result>0</result>");
                    sb.AppendLine(@"</root>");
                }
            }
        }
        catch (Exception ex)
        {
            sb = new StringBuilder("");
            Response.ContentType = "text/xml";
            Response.ContentEncoding = Encoding.UTF8;
            sb.AppendLine(@"<?xml version='1.0' encoding='utf-8' ?>");
            sb.AppendLine(@"<root>");
            sb.AppendLine(string.Format("<result>{0}</result>", ex.Message));
            sb.AppendLine(@"</root>");

            //记录错误的日志
            WriteLog(ex.ToString());


        }
        Response.Write(sb);
        Response.End();

    }

    #region 获取用户信息 Method: GetUserInfo(OAuthAccessToken token,string uid)
    public void GetUserInfo(OAuthAccessToken token, string uid)
    {
        Int64 IntUid;
        Int64.TryParse(uid, out IntUid);
        UserInfo user = Microblog_v2.GetUserInfo(token, IntUid);
        UserModel userModel = new UserModel();
        /* <guid></guid>
         * <result></result>
          <userinfo>   
          <id></id>
          <screenname></screenname>
          <address></address>
          <headerimg></headerimg>
          </userinfo>
        */

        sb.AppendLine(@"<result>1</result>");
        sb.AppendLine(string.Format("<guid>{0}</guid>", Session["guid"].ToString()));
        sb.AppendLine(@"<userinfo>");
        sb.AppendLine(string.Format("<id>{0}</id>", user.ID.ToString()));
        sb.AppendLine(string.Format("<screenname><![CDATA[{0}]]></screenname>", user.ScreenName));
        sb.AppendLine(string.Format("<address><![CDATA[{0}]]></address>", user.Location));
        sb.AppendLine(string.Format("<headerimg>{0}</headerimg>", user.AvatarLarge));
        sb.AppendLine(@"</userinfo>");
    }
    #endregion
    #region 获取粉丝 Method：GetMyFansFromSina(Weiboinfo wb)
    public void GetMyFansFromSina(Weiboinfo wb,bool flag)
    {
        Users_v2 users = new Users_v2();
        
        int pageIndex = 1;
        long userID = Convert.ToInt64(wb.WeiboUID);
        string strApp=(flag==true)?"FansCount":"MyFriendCount";

        int count = int.Parse(ConfigurationManager.AppSettings[strApp]);
        Users summ = new Users();
        //users = Microblog_v2.GetBilateralFriendUsers(wb.WeiboToken, userID, count, pageIndex, null);//获取互粉的好友
        users = Microblog_v2.GetFriends(wb.WeiboToken,userID, pageIndex, count); //获取我关注的
        foreach (UserInfo userInfo in users.Items)
        {
            summ.Items.Add(userInfo);
        }
        if (summ.Items.Count < count)
        {
            Users users2 = new Users();
           
            //users2 = Microblog_v2.GetFollowers(wb.WeiboToken,userID, pageIndex, count);//获取粉丝
            users2 = Microblog_v2.GetBilateralFriendUsers(wb.WeiboToken, userID, count, pageIndex, null);//获取互粉的好友
            var arr = users.Items.Select(v => v.ID).ToArray();
            Users tem = new Users();
            foreach (UserInfo userInfo2 in users2.Items)
            {
                
                //foreach (UserInfo userInfo in summ.Items)
                //{
                    //if (userInfo2.ID != userInfo.ID)//将重复好友筛选出来
                if (!arr.Contains(userInfo2.ID))
                    {
                        tem.Items.Add(userInfo2);
                    }
                //}
            }
            if (tem.Items.Count > 0)
            {//将筛选出的数据添加进summ
                foreach (UserInfo userInfo in tem.Items)
                {
                    summ.Items.Add(userInfo);
                }
            }
            if (summ.Items.Count < count)
            {
                //获取感兴趣的用户
                Collection<UserInfo> uc = Microblog.GetMayInterestedUsers(wb.WeiboToken, count - users.Items.Count, null);
                var arr1 = summ.Items.Select(v => v.ID).ToArray();
                Users tem1 = new Users();
                foreach (UserInfo ui in uc)
                {
                    
                    //foreach (UserInfo userinfo in summ.Items)
                    //{
                    //    if (ui.ID != userinfo.ID)//将重复好友筛选出来
                    if (!arr1.Contains(ui.ID))
                        {
                            tem1.Items.Add(ui);
                        }
                    //}
                }
                if (tem1.Items.Count > 0)
                {//将筛选出的数据添加进summ
                    foreach (UserInfo userInfo in tem1.Items)
                    {
                        summ.Items.Add(userInfo);
                    }
                }

                if (summ.Items.Count < count)
                {
                    
                    //users3 = Microblog_v2.GetHotUsers(wb.WeiboToken,null);//获取系统推荐的用户
                    Collection<UserInfo> collection = new Collection<UserInfo>();
                    collection = Microblog_v2.GetHotUsersArrey(wb.WeiboToken, "default");//获取系统推荐的用户
                    //var mm=  collection.Cast<Users>().ToList();
                    var arr2 = summ.Items.Select(v => v.ID).ToArray();
                    Users tem2 = new Users();
                    foreach (UserInfo userInfo3 in collection.Cast <UserInfo>())
                    {
                        
                        //foreach (UserInfo userInfo in summ.Items)
                        //{
                        //    if (userInfo3.ID != userInfo.ID)//将重复好友筛选出来
                        if (!arr2.Contains(userInfo3.ID))
                            {
                                tem2.Items.Add(userInfo3);
                            }
                        //}
                    }
                    if (tem2.Items.Count > 0)
                    {//将筛选出的数据添加进summ
                        foreach (UserInfo userInfo in tem2.Items)
                        {
                            summ.Items.Add(userInfo);
                        }
                    }
                }
            }
        }
        List<MyFansModel> fansModelList = new List<MyFansModel>();
        if (summ.Items.Count > 0)
        {
            if(flag)
                sb.AppendLine(@"<fans>"); //粉丝
            else
                sb.AppendLine(@"<friends>"); //关系紧密好友
                foreach (UserInfo userInfo in summ.Items)
                {
                    MyFansModel mfm = new MyFansModel();
                    mfm.MyUID = wb.WeiboUID;
                    mfm.FansUID = userInfo.ID.ToString();
                    mfm.FansScreenName = userInfo.ScreenName;
                    mfm.FansProImageUrl = userInfo.ProfileImageUrl;
                    mfm.FansAvatarLarge = userInfo.AvatarLarge;
                    /*
                     * <fans>
                        <header>http://www.hao123.com</header>
                        <header>http://www.hao123.com</header>
                        <header>http://www.hao123.com</header>
                      </fans>
                     */

                    sb.AppendLine(string.Format("<header>{0}</header>", mfm.FansAvatarLarge));
                }
            if(flag)
                sb.AppendLine(@"</fans>");
            else
                sb.AppendLine(@"</friends>");
            }
        }
    
    #endregion
    #region 获取用户发布的地理信息微博 Method:GetGeo(Weiboinfo wb)
    public void GetGeo(Weiboinfo wb)
    {
        Hashtable hd = new Hashtable();
        long userID = Convert.ToInt64(wb.WeiboUID);
        int count=10;
        int pageIndex = 1;
        int flag = 10;
        Statuses statuses = new Statuses();
        Statuses temp = new Statuses();
        while (true)
        {
            if (pageIndex == 4) break;
            if (flag <= 0) break;

            #region ss
            temp = Microblog_v2.GetUserStatuses(wb.WeiboToken, userID, null, null, pageIndex, 200, StatusType.All, false, false);
            //temp = Microblog.GetHomeStatuses(wb.WeiboToken, null, null, pageIndex, 200, StatusType.All, false);
            if (temp.Items.Count == 0) break;
            foreach (StatusInfo info in temp.Items)
            {
                if (!hd.ContainsKey(info.ID))
                {
                    if (info.Geo != null)//筛选出地理微博信息
                    {
                        if (flag >= 0) //筛选出flag条信息
                        {
                            hd.Add(info.ID, info.ID);
                            statuses.Items.Add(info);
                        }
                        else
                        {
                            break;
                        }
                        flag--;
                    }
                }
            }
            #endregion
            if (temp.Items.Count < 200)
                pageIndex = 4;
            else
                pageIndex++;
        }
        if (statuses.Items.Count < count)
        {
            int pagIndex = 1;
            int flag5 = 10;
            while (true)
            {
                if (pagIndex == 4) break;
                if (flag5 <= 0) break;
                Statuses template = new Statuses();
                template = Microblog.GetMentions(wb.WeiboToken, null, null, pagIndex, 200); //@我的
                #region bb
                foreach (StatusInfo info in template.Items)
                {
                    if (info.User != null)
                    {
                        if (!hd.ContainsKey(info.User.ID))
                        {
                            if (info.Geo != null)//筛选出地理微博信息
                            {
                                if (flag5 >= 0) //筛选出flag条信息
                                {
                                    hd.Add(info.User.ID, info.User.ID);
                                    statuses.Items.Add(info);
                                }
                                else
                                {
                                    break;
                                }
                                flag5--;
                            }
                        }
                    }
                }
                #endregion
                if (template.Items.Count < 200)
                    pagIndex = 4;
                else
                    pagIndex++;
            }

        }
        if (statuses.Items.Count > 0)//生成xml
        {
            /*
                * <addressmessage>
                <message>
                    <address>北京</address>
                    <value>ssdsdsd</value>
                </message>
                * </addressmessage>
                */
            sb.AppendLine(@"<addressmessage>");
            foreach (StatusInfo info in statuses.Items)
            {
                sb.AppendLine(@"<message>");
                sb.AppendLine(string.Format("<address><![CDATA[{0}]]></address>", info.Text));
                //sb.AppendLine(string.Format("<value>{0}</value>", info.Text));
                sb.AppendLine(@"</message>");
            }
            sb.AppendLine(@"</addressmessage>");
        }
    }
    #endregion
    #region 获取个人图片微博数据 Method:GetImg(Weiboinfo wb)
    public void GetImg(Weiboinfo wb)
    {
        long userID = Convert.ToInt64(wb.WeiboUID);
        int pageIndex = 1;
        int flag = 10;
        Statuses statuses = new Statuses();
        while (true)
        {
            if (pageIndex == 4) break;
            if (flag <= 0) break;
            Statuses temp = new Statuses();
            temp = Microblog_v2.GetUserStatuses(wb.WeiboToken,userID, null, null, pageIndex, 200, StatusType.All, false, false);
            if (temp.Items.Count == 0) break;
            foreach (StatusInfo info in temp.Items)
            {
                if (info.OriginalPic != null)//筛选出带图片的微博信息
                {
                    if (flag >= 0) //筛选出flag条信息
                    {
                        statuses.Items.Add(info);
                    }
                    else
                    {
                        break;
                    }
                    flag--;
                }
            }
            if (temp.Items.Count < 200)
                pageIndex = 4;
            else
                pageIndex++;
        }

        if (statuses.Items.Count > 0)//生成xml
        {
            /*
             * <imgmessage>
                 * <message>
                       <original>http://www.hao123.com</original>
             *         <middle>http://www.hao123.com</middle>
                       <thumbnail>http://www.hao123.com</thumbnail>
                 * <message>
               </imgmessage>
             */
            sb.AppendLine(@"<imgmessage>");
            foreach (StatusInfo info in statuses.Items)
            {
                sb.AppendLine(@"<message>");
                sb.AppendLine(string.Format("<original>{0}</original>", info.OriginalPic));
                sb.AppendLine(string.Format("<middle>{0}</middle>", info.MiddlePic));
                sb.AppendLine(string.Format("<thumbnail>{0}</thumbnail>", info.ThumbnailPic));
                sb.AppendLine(@"</message>");
            }
            sb.AppendLine(@"</imgmessage>");
        }
    }
    #endregion
    #region 获取个人获得的评论 Method:GetComment()
    public void GetComment(Weiboinfo wb)
    {
        Hashtable hd = new Hashtable();
        int commentCount = 30;
        int pageIndex = 1;
        int pageIndex_1 = 1;
        int flag_1 = 10;
        int flag = 10;
        int flag2 = 10;
         int flag2_1 = 10;
        int flag3 = 10;
        Comments comments = new Comments();

        while (true)
        {
            if (flag_1 <= 0) break;
            if (pageIndex_1 == 4) break; //只调3次接口
            Comments temp_1 = new Comments();
            temp_1 = Microblog_v2.GetCommentsToMe(wb.WeiboToken,null, null, pageIndex_1, 200);
            if (temp_1.Items.Count == 0) break;
            foreach (CommentInfo info in temp_1.Items)
            {
                if (info.User != null)
                {
                    //筛选出评论人的一条评论
                    if (!hd.ContainsKey(info.User.ID) && Check(info.Text))
                    {
                        if (flag_1 > 0)
                        {
                            hd.Add(info.User.ID, info.User.ID);
                            comments.Items.Add(info);
                            flag_1--;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            if (temp_1.Items.Count < 200)
                pageIndex_1 = 4;
            else
                pageIndex_1++;
        }
        if (comments.Items.Count < commentCount) //获取最新的提到登录用户的微博列表，即@我的微博
        {
            int pIndex_1 = 1;
            while (true)
            {

                if (flag2_1 <= 0) break;
                if (pIndex_1 == 4) break; //指调3次接口
                Statuses template_1 = new Statuses();
                template_1 = Microblog.GetMentions(wb.WeiboToken, null, null, pIndex_1, 200);
                if (template_1.Items.Count == 0) break;
                foreach (StatusInfo info in template_1.Items)
                {
                    if (info.User != null)
                    {
                        if (!hd.ContainsKey(info.User.ID) && Check(info.Text))
                        {
                            if (flag2_1 > 0)
                            {
                                hd.Add(info.User.ID, info.User.ID);
                                CommentInfo comInfo = new CommentInfo();
                                comInfo.User = info.User;
                                comInfo.User.ScreenName = info.User.ScreenName;
                                comInfo.User.AvatarLarge = info.User.AvatarLarge;
                                comInfo.Text = info.Text;
                                comments.Items.Add(comInfo);
                                flag2_1--;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
                if (template_1.Items.Count < 200)
                    pIndex_1 = 4;
                else
                    pIndex_1++;
            }
        }


        if (comments.Items.Count < commentCount)
        {

            while (true)
            {
                if (flag <= 0) break;
                if (pageIndex == 4) break; //只调3次接口
                Comments temp = new Comments();
                temp = Microblog_v2.GetCommentsToMe(wb.WeiboToken, null, null, pageIndex, 200);
                if (temp.Items.Count == 0) break;
                foreach (CommentInfo info in temp.Items)
                {
                    if (info.User != null)
                    {
                        //筛选出评论人的一条评论
                        if (!hd.ContainsKey(info.User.ID))
                        {
                            if (flag > 0)
                            {
                                hd.Add(info.User.ID, info.User.ID);
                                comments.Items.Add(info);
                                flag--;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
                if (temp.Items.Count < 200)
                    pageIndex = 4;
                else
                    pageIndex++;
            }
        }
        if (comments.Items.Count < commentCount) //获取最新的提到登录用户的微博列表，即@我的微博
        {
            int pIndex = 1;
            while (true)
            {
               
                if (flag2 <= 0) break;
                if (pIndex == 4) break; //指调3次接口
                Statuses template = new Statuses();
                template = Microblog.GetMentions(wb.WeiboToken, null, null, pIndex, 200);
                if (template.Items.Count == 0) break;
                foreach (StatusInfo info in template.Items)
                {
                    if (info.User != null)
                    {
                        if (!hd.ContainsKey(info.User.ID))
                        {
                            if (flag2 > 0)
                            {
                                hd.Add(info.User.ID, info.User.ID);
                                CommentInfo comInfo = new CommentInfo();
                                comInfo.User = info.User;
                                comInfo.User.ScreenName = info.User.ScreenName;
                                comInfo.User.AvatarLarge = info.User.AvatarLarge;
                                comInfo.Text = info.Text;
                                comments.Items.Add(comInfo);
                                flag2--;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
                if (template.Items.Count < 200)
                    pIndex = 4;
                else
                    pIndex++;
            }
            if (comments.Items.Count < commentCount)//获取最新的公共微博
            {
                int publicCount = 20;
               
                {
                    Statuses templetes = new Statuses();
                    templetes = Microblog.GetPublicStatuses(wb.WeiboToken,publicCount, false);
                    foreach (StatusInfo info in templetes.Items)
                    {
                        if (flag3 > 0)
                        {
                            CommentInfo cinfo = new CommentInfo();
                            cinfo.User = info.User;
                            cinfo.User.ScreenName = info.User.ScreenName;
                            cinfo.User.AvatarLarge = info.User.AvatarLarge;
                            cinfo.Text = info.Text;
                            comments.Items.Add(cinfo);
                            flag3--;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
        }
        if (comments.Items.Count > 0)
        {
            /*
             * <comments>
                    <commnet>
                      <screenname></screenname>
                      <header></header>
                      <value></value>
                    </commnet>
             * <comments>
             */
            sb.AppendLine(@"<comments>");
            foreach (CommentInfo info in comments.Items)
            {
                sb.AppendLine(@"<comment>");
                sb.AppendLine(string.Format("<screenname><![CDATA[{0}]]></screenname>", info.User.Name));
                sb.AppendLine(string.Format("<header>{0}</header>", info.User.AvatarLarge));
                sb.AppendLine(string.Format("<value><![CDATA[{0}]]></value>", info.Text));
                sb.AppendLine(@"</comment>");
            }
            sb.AppendLine(@"</comments>");
        }
    }
    #endregion

    public bool Check(string content)
    {
        bool flag = false;
        string[] keys = { "Delonghi", "德龙", "Krups", "Jura", "优锐", "飞利浦", "Dolce Gusto", "雀巢咖啡", "速溶", "冲泡", "茶", "差", "过分", "奇怪", "恶心", "难喝", "代购", "胃疼", "失眠" };
        string[] arr = {
                               "Nespresso", "coffee", "cafe", "奶沫", "拿铁", "卡布奇诺", "玛奇朵", "精致", "咖啡", "朋友", "分享", "午后", "在家"
                               , "开心", "愉悦", "难忘", "瞬间", "美妙", "回忆", "温暖", "读书", "宁静", "淡雅", "清新", "心情", "故事", "享受",
                               "espresso", "cappuccino", "macchiato", "甜点", "香味", "浪漫", "酒店", "意式"
                           };
        foreach (string key in keys)
        {
            if (content.IndexOf(key) > 0)
            {
                flag = false;//包含关键字
                return flag;
            }
        }


        foreach (string key in arr)
        {
            if (content.IndexOf(key) > 0)
            {
                flag = true;//不包含关键字
                break;
            }
        }

        return flag;
    }

    #region 获取关系紧密的好友 Method:GetActiveFollowers(Weiboinfo wb)
    public void GetActiveFollowers(Weiboinfo wb)
    {
        Users users = new Users();
        long userID = Convert.ToInt64(wb.WeiboUID);
        int activeCount = 10;
        users = Microblog_v2.GetActiveFollowers(wb.WeiboToken,userID, activeCount);
        if (users.Items.Count > 0)
        {
            sb.AppendLine(@"<friends>");
            foreach (UserInfo userInfo in users.Items)
            {
                /*
                 * <friends>
                    <header></header>
                    <header></header>
                    <header></header>
                  </friends>
                 */
                sb.AppendLine(string.Format("<header>{0}</header>", userInfo.AvatarLarge));
            }
            sb.AppendLine(@"</friends>");
        }
    }
    #endregion
    #region 数据库操作
    /// <summary>
    /// 将xml保存到数据库
    /// </summary>
    /// <param name="sb">xml字符串</param>
    /// <param name="guid">guid</param>
    /// <returns>返回id</returns>
    public int SaveXml(StringBuilder sb,string guid,string lang)
    {
        return new UserBLL().Save(sb, guid, lang);
    }
    /// <summary>
    /// 获取Xml
    /// </summary>
    /// <param name="guid">guid</param>
    /// <returns>值</returns>
    public string GetXml(string guid)
    {
        return new UserBLL().GerXml(guid);
    }
    #endregion

    public static void WriteLog(string message)
    {
        ILogger logger = LoggerFactory.Init();
        logger.Info(message);
    }
}